package com.itheima.health.dao;

import com.itheima.health.pojo.Member;
import com.itheima.health.pojo.Order;
import com.itheima.health.pojo.OrderInfo;
import com.itheima.health.vo.OrderSubmitParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 预约DAO
 */
@Mapper
public interface OrderDao {

    /**
     * 添加预约信息
     * @param order
     */
    void addOrder(Order order);

    /**
     * 添加会员id绑定会员信息
     * @param id
     */
    void addMemberId(Integer id);

    /**
     * 根据会员id查询order表单
     * @param id
     * @return
     */
    Order selectMemberId(Integer id);


    Order selectById(@Param("id") Integer id);

    OrderInfo selectSetmealAndMemberByOrderId(@Param("id") Integer id);
    /**
     * 根据订单日期范围和订单状态统计
     * @param starDate
     * @param endDate
     * @param status
     * @return
     */
    Long countByOrderDateRange(@Param("starDate") Date starDate, @Param("endDate") Date endDate, @Param("status") String status);

    /**
     * 统计预约梳理最多的前topN个套现的信息
     * 返回数据格式:
     * [ {"proportion":0.4545,"name":"粉红珍爱(女)升级TM12项筛查体检套餐","setmeal_count":5}]
     * @param topN
     * @return
     */
    List<Map<String,Object>> countByHotSetMeal(@Param("topN") int topN);
}
